import http from '@/utils/http'

// 用户登录
export const login = (data: { username: string; password: string }) => {
  return http.post('/user/login.do', data)
}

// 用户登出
export const logout = () => {
  return http.post('/user/logout.do')
}

// 获取当前用户信息
export const getUserInfo = () => {
  return http.get('/user/info.do')
}

// 获取用户列表
export const getUserList = (params: { pageNum: number; pageSize: number }) => {
  return http.get('/user/list.do', { params })
}

// 创建用户
export const createUser = (data: any) => {
  return http.post('/user/create.do', data)
}

// 更新用户
export const updateUser = (data: any) => {
  return http.post('/user/update.do', data)
}

// 删除用户
export const deleteUser = (id: number) => {
  return http.delete(`/user/delete/${id}.do`)
}